package reduce.fz.com.reduce.fragment;

import android.app.Activity;
import android.net.Uri;
import android.os.Bundle;
import android.app.Fragment;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import reduce.fz.com.reduce.R;
import reduce.fz.com.reduce.abstracts.AbRecycleScroollListener;
import reduce.fz.com.reduce.fragment.base.BaseFragment;

public class ShequCardsFragment extends BaseFragment implements SwipeRefreshLayout.OnRefreshListener {
    private SwipeRefreshLayout mSwipeRefreshWidget;
    private RecyclerView mCardList;
    private LinearLayoutManager mLayoutManager;


    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        return inflater.inflate(R.layout.fragment_shequ_cards, container, false);
    }

    public void initWidget() {
        mSwipeRefreshWidget = (SwipeRefreshLayout) this.getActivity().findViewById(R.id.swipe_refresh_widget);
        mCardList = (RecyclerView) this.getActivity().findViewById(R.id.card_list);
    }

    public void initListener() {
        mSwipeRefreshWidget.setOnRefreshListener(this);
        mSwipeRefreshWidget.setProgressViewOffset(false, 100, 200);
    }

    public void initCardList() {
        mCardList.setHasFixedSize(true);
        mLayoutManager = new LinearLayoutManager(this.getActivity());
        mCardList.setLayoutManager(mLayoutManager);
        mCardList.setItemAnimator(new DefaultItemAnimator());

        mLayoutManager = new LinearLayoutManager(getActivity());
        mCardList.setOnScrollListener(new AbRecycleScroollListener(mLayoutManager) {
            @Override
            public void onLoadMore() {

            }
        });
    }


    @Override
    public void onRefresh() {
        //下拉刷新(置顶)

    }
}
